/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JEVEMeMineralWorksheetBox.java
 *
 * Created on Jun 15, 2011, 7:48:52 PM
 */
package jeveme;

import java.math.BigDecimal;
import org.jdesktop.application.Action;
import java.net.URLEncoder;
import java.net.URL;
import java.net.URLConnection;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.xpath.*;
import javax.xml.parsers.*;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
import org.w3c.dom.Element;

/**
 *
 * @author raulruiz
 */
public class JEVEMeMineralWorksheetBox extends javax.swing.JDialog {

    /** Creates new form JEVEMeMineralWorksheetBox */
    public JEVEMeMineralWorksheetBox(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        tritaniumPricePerTextBox = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        tritaniumQuantityTextBox = new javax.swing.JTextField();
        tritaniumSubtotalTextBox = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        pyeritePricePerTextBox = new javax.swing.JTextField();
        pyeriteQuantityTextBox = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        pyeriteSubtotalTextBox = new javax.swing.JTextField();
        jPanel3 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        mexallonPricePerTextBox = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        mexallonQuantityTextBox = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        mexallonSubtotalTextBox = new javax.swing.JTextField();
        jPanel4 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        isogenPricePerTextBox = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        isogenQuantityTextBox = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        isogenSubtotalTextBox = new javax.swing.JTextField();
        jPanel5 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        nocxiumPricePerTextBox = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        nocxiumQuantityTextBox = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        nocxiumSubtotalTextBox = new javax.swing.JTextField();
        jPanel6 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        zydrinePricePerTextBox = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        zydrineQuantityTextBox = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        zydrineSubtotalTextBox = new javax.swing.JTextField();
        jPanel7 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        megacytePricePerTextBox = new javax.swing.JTextField();
        jLabel28 = new javax.swing.JLabel();
        megacyteQuantityTextBox = new javax.swing.JTextField();
        jLabel29 = new javax.swing.JLabel();
        megacyteSubtotalTextBox = new javax.swing.JTextField();
        jPanel8 = new javax.swing.JPanel();
        jLabel8 = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        morphitePricePerTextBox = new javax.swing.JTextField();
        jLabel31 = new javax.swing.JLabel();
        morphiteQuantityTextBox = new javax.swing.JTextField();
        jLabel32 = new javax.swing.JLabel();
        morphiteSubtotalTextBox = new javax.swing.JTextField();
        statusPanel = new javax.swing.JPanel();
        jLabel33 = new javax.swing.JLabel();
        totalValueLabel = new javax.swing.JLabel();
        iskIconLabel = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        lockPricesMenu = new javax.swing.JMenu();
        lockPricesMenuItem = new javax.swing.JCheckBoxMenuItem();
        fetchOnlinePricesMenu = new javax.swing.JMenu();
        addPriceSourceMenuItem = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        battleClinicPricesMenuItem = new javax.swing.JMenuItem();
        complexionPricesMenuItem = new javax.swing.JMenuItem();
        eveCentralPricesMenuItem = new javax.swing.JMenuItem();
        matariPricesMenuItem = new javax.swing.JMenuItem();
        resetQuantitiesMenu = new javax.swing.JMenu();
        resetQuantitiesMenuItem = new javax.swing.JMenuItem();
        jMenu4 = new javax.swing.JMenu();
        copyFormattedMenuItem = new javax.swing.JMenuItem();
        copyUnformattedMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(jeveme.JEVEMeApp.class).getContext().getResourceMap(JEVEMeMineralWorksheetBox.class);
        setTitle(resourceMap.getString("MineralWorksheetForm.title")); // NOI18N
        setName("MineralWorksheetForm"); // NOI18N
        setResizable(false);

        mainPanel.setBackground(resourceMap.getColor("mainPanel.background")); // NOI18N
        mainPanel.setName("mainPanel"); // NOI18N
        mainPanel.setPreferredSize(new java.awt.Dimension(680, 650));
        mainPanel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPanel1.setBackground(resourceMap.getColor("jPanel1.background")); // NOI18N
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel1.border.title"))); // NOI18N
        jPanel1.setName("jPanel1"); // NOI18N
        jPanel1.setPreferredSize(new java.awt.Dimension(328, 168));

        jLabel1.setIcon(resourceMap.getIcon("jLabel1.icon")); // NOI18N
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel9.setLabelFor(tritaniumPricePerTextBox);
        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N

        tritaniumPricePerTextBox.setText(resourceMap.getString("tritaniumPricePerTextBox.text")); // NOI18N
        tritaniumPricePerTextBox.setName("tritaniumPricePerTextBox"); // NOI18N
        tritaniumPricePerTextBox.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                tritaniumPricePerTextBoxFocusLost(evt);
            }
        });

        jLabel10.setLabelFor(tritaniumQuantityTextBox);
        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N

        jLabel11.setLabelFor(tritaniumSubtotalTextBox);
        jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
        jLabel11.setName("jLabel11"); // NOI18N

        tritaniumQuantityTextBox.setText(resourceMap.getString("tritaniumQuantityTextBox.text")); // NOI18N
        tritaniumQuantityTextBox.setName("tritaniumQuantityTextBox"); // NOI18N
        tritaniumQuantityTextBox.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                tritaniumQuantityTextBoxFocusLost(evt);
            }
        });

        tritaniumSubtotalTextBox.setEditable(false);
        tritaniumSubtotalTextBox.setText(resourceMap.getString("tritaniumSubtotalTextBox.text")); // NOI18N
        tritaniumSubtotalTextBox.setName("tritaniumSubtotalTextBox"); // NOI18N

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(jLabel1)
                .add(18, 18, 18)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel9)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel10)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel11))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(tritaniumSubtotalTextBox)
                    .add(tritaniumQuantityTextBox)
                    .add(tritaniumPricePerTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(108, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel1)
                    .add(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel9)
                            .add(tritaniumPricePerTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel10)
                            .add(tritaniumQuantityTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel11)
                            .add(tritaniumSubtotalTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(58, Short.MAX_VALUE))
        );

        mainPanel.add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 29, -1, -1));

        jPanel2.setBackground(resourceMap.getColor("jPanel2.background")); // NOI18N
        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel2.border.title"))); // NOI18N
        jPanel2.setName("jPanel2"); // NOI18N
        jPanel2.setPreferredSize(new java.awt.Dimension(328, 168));

        jLabel2.setIcon(resourceMap.getIcon("jLabel2.icon")); // NOI18N
        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel12.setLabelFor(pyeritePricePerTextBox);
        jLabel12.setText(resourceMap.getString("jLabel12.text")); // NOI18N
        jLabel12.setName("jLabel12"); // NOI18N

        pyeritePricePerTextBox.setText(resourceMap.getString("pyeritePricePerTextBox.text")); // NOI18N
        pyeritePricePerTextBox.setName("pyeritePricePerTextBox"); // NOI18N
        pyeritePricePerTextBox.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                pyeritePricePerTextBoxFocusLost(evt);
            }
        });

        pyeriteQuantityTextBox.setText(resourceMap.getString("pyeriteQuantityTextBox.text")); // NOI18N
        pyeriteQuantityTextBox.setName("pyeriteQuantityTextBox"); // NOI18N
        pyeriteQuantityTextBox.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                pyeriteQuantityTextBoxFocusLost(evt);
            }
        });

        jLabel13.setLabelFor(pyeriteQuantityTextBox);
        jLabel13.setText(resourceMap.getString("jLabel13.text")); // NOI18N
        jLabel13.setName("jLabel13"); // NOI18N

        jLabel14.setLabelFor(pyeriteSubtotalTextBox);
        jLabel14.setText(resourceMap.getString("jLabel14.text")); // NOI18N
        jLabel14.setName("jLabel14"); // NOI18N

        pyeriteSubtotalTextBox.setEditable(false);
        pyeriteSubtotalTextBox.setText(resourceMap.getString("pyeriteSubtotalTextBox.text")); // NOI18N
        pyeriteSubtotalTextBox.setName("pyeriteSubtotalTextBox"); // NOI18N

        org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .add(jLabel2)
                .add(18, 18, 18)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel12)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel13)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel14))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(pyeriteSubtotalTextBox)
                    .add(pyeriteQuantityTextBox)
                    .add(pyeritePricePerTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(108, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel2)
                    .add(jPanel2Layout.createSequentialGroup()
                        .addContainerGap()
                        .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel12)
                            .add(pyeritePricePerTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel13)
                            .add(pyeriteQuantityTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel14)
                            .add(pyeriteSubtotalTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(58, Short.MAX_VALUE))
        );

        mainPanel.add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 208, -1, -1));

        jPanel3.setBackground(resourceMap.getColor("jPanel3.background")); // NOI18N
        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel3.border.title"))); // NOI18N
        jPanel3.setName("jPanel3"); // NOI18N
        jPanel3.setPreferredSize(new java.awt.Dimension(328, 168));

        jLabel3.setIcon(resourceMap.getIcon("jLabel3.icon")); // NOI18N
        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jLabel15.setLabelFor(mexallonPricePerTextBox);
        jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N
        jLabel15.setName("jLabel15"); // NOI18N

        mexallonPricePerTextBox.setText(resourceMap.getString("mexallonPricePerTextBox.text")); // NOI18N
        mexallonPricePerTextBox.setName("mexallonPricePerTextBox"); // NOI18N
        mexallonPricePerTextBox.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                mexallonPricePerTextBoxFocusLost(evt);
            }
        });

        jLabel16.setLabelFor(mexallonQuantityTextBox);
        jLabel16.setText(resourceMap.getString("jLabel16.text")); // NOI18N
        jLabel16.setName("jLabel16"); // NOI18N

        mexallonQuantityTextBox.setText(resourceMap.getString("mexallonQuantityTextBox.text")); // NOI18N
        mexallonQuantityTextBox.setName("mexallonQuantityTextBox"); // NOI18N
        mexallonQuantityTextBox.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                mexallonQuantityTextBoxFocusLost(evt);
            }
        });

        jLabel17.setLabelFor(mexallonSubtotalTextBox);
        jLabel17.setText(resourceMap.getString("jLabel17.text")); // NOI18N
        jLabel17.setName("jLabel17"); // NOI18N

        mexallonSubtotalTextBox.setEditable(false);
        mexallonSubtotalTextBox.setText(resourceMap.getString("mexallonSubtotalTextBox.text")); // NOI18N
        mexallonSubtotalTextBox.setName("mexallonSubtotalTextBox"); // NOI18N

        org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .add(jLabel3)
                .add(18, 18, 18)
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel15)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel16)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel17))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(mexallonSubtotalTextBox)
                    .add(mexallonQuantityTextBox)
                    .add(mexallonPricePerTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(108, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel3)
                    .add(jPanel3Layout.createSequentialGroup()
                        .addContainerGap()
                        .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel15)
                            .add(mexallonPricePerTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel16)
                            .add(mexallonQuantityTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel17)
                            .add(mexallonSubtotalTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(58, Short.MAX_VALUE))
        );

        mainPanel.add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 382, -1, -1));

        jPanel4.setBackground(resourceMap.getColor("jPanel4.background")); // NOI18N
        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel4.border.title"))); // NOI18N
        jPanel4.setName("jPanel4"); // NOI18N
        jPanel4.setPreferredSize(new java.awt.Dimension(328, 168));

        jLabel4.setIcon(resourceMap.getIcon("jLabel4.icon")); // NOI18N
        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jLabel18.setLabelFor(isogenPricePerTextBox);
        jLabel18.setText(resourceMap.getString("jLabel18.text")); // NOI18N
        jLabel18.setName("jLabel18"); // NOI18N

        isogenPricePerTextBox.setText(resourceMap.getString("isogenPricePerTextBox.text")); // NOI18N
        isogenPricePerTextBox.setName("isogenPricePerTextBox"); // NOI18N
        isogenPricePerTextBox.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                isogenPricePerTextBoxFocusLost(evt);
            }
        });

        jLabel19.setLabelFor(isogenQuantityTextBox);
        jLabel19.setText(resourceMap.getString("jLabel19.text")); // NOI18N
        jLabel19.setName("jLabel19"); // NOI18N

        isogenQuantityTextBox.setText(resourceMap.getString("isogenQuantityTextBox.text")); // NOI18N
        isogenQuantityTextBox.setName("isogenQuantityTextBox"); // NOI18N
        isogenQuantityTextBox.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                isogenQuantityTextBoxFocusLost(evt);
            }
        });

        jLabel20.setLabelFor(isogenSubtotalTextBox);
        jLabel20.setText(resourceMap.getString("jLabel20.text")); // NOI18N
        jLabel20.setName("jLabel20"); // NOI18N

        isogenSubtotalTextBox.setEditable(false);
        isogenSubtotalTextBox.setText(resourceMap.getString("isogenSubtotalTextBox.text")); // NOI18N
        isogenSubtotalTextBox.setName("isogenSubtotalTextBox"); // NOI18N

        org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel4Layout.createSequentialGroup()
                .add(jLabel4)
                .add(18, 18, 18)
                .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel18)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel19)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel20))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(isogenSubtotalTextBox)
                    .add(isogenQuantityTextBox)
                    .add(isogenPricePerTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(108, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel4Layout.createSequentialGroup()
                .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel4)
                    .add(jPanel4Layout.createSequentialGroup()
                        .addContainerGap()
                        .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel18)
                            .add(isogenPricePerTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel19)
                            .add(isogenQuantityTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel20)
                            .add(isogenSubtotalTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(58, Short.MAX_VALUE))
        );

        mainPanel.add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 556, -1, -1));

        jPanel5.setBackground(resourceMap.getColor("jPanel5.background")); // NOI18N
        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel5.border.title"))); // NOI18N
        jPanel5.setName("jPanel5"); // NOI18N
        jPanel5.setPreferredSize(new java.awt.Dimension(328, 168));

        jLabel5.setIcon(resourceMap.getIcon("jLabel5.icon")); // NOI18N
        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jLabel21.setLabelFor(nocxiumPricePerTextBox);
        jLabel21.setText(resourceMap.getString("jLabel21.text")); // NOI18N
        jLabel21.setName("jLabel21"); // NOI18N

        nocxiumPricePerTextBox.setText(resourceMap.getString("nocxiumPricePerTextBox.text")); // NOI18N
        nocxiumPricePerTextBox.setName("nocxiumPricePerTextBox"); // NOI18N
        nocxiumPricePerTextBox.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                nocxiumPricePerTextBoxFocusLost(evt);
            }
        });

        jLabel22.setLabelFor(nocxiumQuantityTextBox);
        jLabel22.setText(resourceMap.getString("jLabel22.text")); // NOI18N
        jLabel22.setName("jLabel22"); // NOI18N

        nocxiumQuantityTextBox.setText(resourceMap.getString("nocxiumQuantityTextBox.text")); // NOI18N
        nocxiumQuantityTextBox.setName("nocxiumQuantityTextBox"); // NOI18N
        nocxiumQuantityTextBox.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                nocxiumQuantityTextBoxFocusLost(evt);
            }
        });

        jLabel23.setLabelFor(nocxiumSubtotalTextBox);
        jLabel23.setText(resourceMap.getString("jLabel23.text")); // NOI18N
        jLabel23.setName("jLabel23"); // NOI18N

        nocxiumSubtotalTextBox.setEditable(false);
        nocxiumSubtotalTextBox.setText(resourceMap.getString("nocxiumSubtotalTextBox.text")); // NOI18N
        nocxiumSubtotalTextBox.setName("nocxiumSubtotalTextBox"); // NOI18N

        org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel5Layout.createSequentialGroup()
                .add(jLabel5)
                .addContainerGap(252, Short.MAX_VALUE))
            .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jPanel5Layout.createSequentialGroup()
                    .add(86, 86, 86)
                    .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel21)
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel22)
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel23))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                        .add(nocxiumSubtotalTextBox)
                        .add(nocxiumQuantityTextBox)
                        .add(nocxiumPricePerTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(104, Short.MAX_VALUE)))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel5Layout.createSequentialGroup()
                .add(jLabel5)
                .addContainerGap(77, Short.MAX_VALUE))
            .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jPanel5Layout.createSequentialGroup()
                    .add(14, 14, 14)
                    .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jLabel21)
                        .add(nocxiumPricePerTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jLabel22)
                        .add(nocxiumQuantityTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jLabel23)
                        .add(nocxiumSubtotalTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(55, Short.MAX_VALUE)))
        );

        mainPanel.add(jPanel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(356, 29, -1, -1));

        jPanel6.setBackground(resourceMap.getColor("jPanel6.background")); // NOI18N
        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel6.border.title"))); // NOI18N
        jPanel6.setName("jPanel6"); // NOI18N
        jPanel6.setPreferredSize(new java.awt.Dimension(328, 168));

        jLabel7.setIcon(resourceMap.getIcon("jLabel7.icon")); // NOI18N
        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        jLabel24.setLabelFor(zydrinePricePerTextBox);
        jLabel24.setText(resourceMap.getString("jLabel24.text")); // NOI18N
        jLabel24.setName("jLabel24"); // NOI18N

        zydrinePricePerTextBox.setText(resourceMap.getString("zydrinePricePerTextBox.text")); // NOI18N
        zydrinePricePerTextBox.setName("zydrinePricePerTextBox"); // NOI18N
        zydrinePricePerTextBox.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                zydrinePricePerTextBoxFocusLost(evt);
            }
        });

        jLabel25.setLabelFor(zydrineQuantityTextBox);
        jLabel25.setText(resourceMap.getString("jLabel25.text")); // NOI18N
        jLabel25.setName("jLabel25"); // NOI18N

        zydrineQuantityTextBox.setText(resourceMap.getString("zydrineQuantityTextBox.text")); // NOI18N
        zydrineQuantityTextBox.setName("zydrineQuantityTextBox"); // NOI18N
        zydrineQuantityTextBox.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                zydrineQuantityTextBoxFocusLost(evt);
            }
        });

        jLabel26.setLabelFor(zydrineSubtotalTextBox);
        jLabel26.setText(resourceMap.getString("jLabel26.text")); // NOI18N
        jLabel26.setName("jLabel26"); // NOI18N

        zydrineSubtotalTextBox.setEditable(false);
        zydrineSubtotalTextBox.setText(resourceMap.getString("zydrineSubtotalTextBox.text")); // NOI18N
        zydrineSubtotalTextBox.setName("zydrineSubtotalTextBox"); // NOI18N

        org.jdesktop.layout.GroupLayout jPanel6Layout = new org.jdesktop.layout.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel6Layout.createSequentialGroup()
                .add(jLabel7)
                .addContainerGap(252, Short.MAX_VALUE))
            .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jPanel6Layout.createSequentialGroup()
                    .add(86, 86, 86)
                    .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel24)
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel25)
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel26))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                        .add(zydrineSubtotalTextBox)
                        .add(zydrineQuantityTextBox)
                        .add(zydrinePricePerTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(104, Short.MAX_VALUE)))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel6Layout.createSequentialGroup()
                .add(jLabel7)
                .addContainerGap(77, Short.MAX_VALUE))
            .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jPanel6Layout.createSequentialGroup()
                    .add(14, 14, 14)
                    .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jLabel24)
                        .add(zydrinePricePerTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jLabel25)
                        .add(zydrineQuantityTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jLabel26)
                        .add(zydrineSubtotalTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(55, Short.MAX_VALUE)))
        );

        mainPanel.add(jPanel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(356, 208, -1, -1));

        jPanel7.setBackground(resourceMap.getColor("jPanel7.background")); // NOI18N
        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel7.border.title"))); // NOI18N
        jPanel7.setName("jPanel7"); // NOI18N
        jPanel7.setPreferredSize(new java.awt.Dimension(328, 168));

        jLabel6.setIcon(resourceMap.getIcon("jLabel6.icon")); // NOI18N
        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        jLabel27.setLabelFor(megacytePricePerTextBox);
        jLabel27.setText(resourceMap.getString("jLabel27.text")); // NOI18N
        jLabel27.setName("jLabel27"); // NOI18N

        megacytePricePerTextBox.setText(resourceMap.getString("megacytePricePerTextBox.text")); // NOI18N
        megacytePricePerTextBox.setName("megacytePricePerTextBox"); // NOI18N
        megacytePricePerTextBox.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                megacytePricePerTextBoxFocusLost(evt);
            }
        });

        jLabel28.setLabelFor(megacyteQuantityTextBox);
        jLabel28.setText(resourceMap.getString("jLabel28.text")); // NOI18N
        jLabel28.setName("jLabel28"); // NOI18N

        megacyteQuantityTextBox.setText(resourceMap.getString("megacyteQuantityTextBox.text")); // NOI18N
        megacyteQuantityTextBox.setName("megacyteQuantityTextBox"); // NOI18N
        megacyteQuantityTextBox.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                megacyteQuantityTextBoxFocusLost(evt);
            }
        });

        jLabel29.setLabelFor(megacyteSubtotalTextBox);
        jLabel29.setText(resourceMap.getString("jLabel29.text")); // NOI18N
        jLabel29.setName("jLabel29"); // NOI18N

        megacyteSubtotalTextBox.setEditable(false);
        megacyteSubtotalTextBox.setText(resourceMap.getString("megacyteSubtotalTextBox.text")); // NOI18N
        megacyteSubtotalTextBox.setName("megacyteSubtotalTextBox"); // NOI18N

        org.jdesktop.layout.GroupLayout jPanel7Layout = new org.jdesktop.layout.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel7Layout.createSequentialGroup()
                .add(jLabel6)
                .addContainerGap(252, Short.MAX_VALUE))
            .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jPanel7Layout.createSequentialGroup()
                    .add(86, 86, 86)
                    .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel27)
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel28)
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel29))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                        .add(megacyteSubtotalTextBox)
                        .add(megacyteQuantityTextBox)
                        .add(megacytePricePerTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(104, Short.MAX_VALUE)))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel7Layout.createSequentialGroup()
                .add(jLabel6)
                .addContainerGap(77, Short.MAX_VALUE))
            .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jPanel7Layout.createSequentialGroup()
                    .add(14, 14, 14)
                    .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jLabel27)
                        .add(megacytePricePerTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jLabel28)
                        .add(megacyteQuantityTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jLabel29)
                        .add(megacyteSubtotalTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(55, Short.MAX_VALUE)))
        );

        mainPanel.add(jPanel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(356, 382, -1, -1));

        jPanel8.setBackground(resourceMap.getColor("jPanel8.background")); // NOI18N
        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel8.border.title"))); // NOI18N
        jPanel8.setName("jPanel8"); // NOI18N
        jPanel8.setPreferredSize(new java.awt.Dimension(328, 168));

        jLabel8.setIcon(resourceMap.getIcon("jLabel8.icon")); // NOI18N
        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        jLabel30.setLabelFor(morphitePricePerTextBox);
        jLabel30.setText(resourceMap.getString("jLabel30.text")); // NOI18N
        jLabel30.setName("jLabel30"); // NOI18N

        morphitePricePerTextBox.setText(resourceMap.getString("morphitePricePerTextBox.text")); // NOI18N
        morphitePricePerTextBox.setName("morphitePricePerTextBox"); // NOI18N
        morphitePricePerTextBox.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                morphitePricePerTextBoxFocusLost(evt);
            }
        });

        jLabel31.setLabelFor(morphiteQuantityTextBox);
        jLabel31.setText(resourceMap.getString("jLabel31.text")); // NOI18N
        jLabel31.setName("jLabel31"); // NOI18N

        morphiteQuantityTextBox.setText(resourceMap.getString("morphiteQuantityTextBox.text")); // NOI18N
        morphiteQuantityTextBox.setName("morphiteQuantityTextBox"); // NOI18N
        morphiteQuantityTextBox.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                morphiteQuantityTextBoxFocusLost(evt);
            }
        });

        jLabel32.setLabelFor(morphiteSubtotalTextBox);
        jLabel32.setText(resourceMap.getString("jLabel32.text")); // NOI18N
        jLabel32.setName("jLabel32"); // NOI18N

        morphiteSubtotalTextBox.setEditable(false);
        morphiteSubtotalTextBox.setText(resourceMap.getString("morphiteSubtotalTextBox.text")); // NOI18N
        morphiteSubtotalTextBox.setName("morphiteSubtotalTextBox"); // NOI18N

        org.jdesktop.layout.GroupLayout jPanel8Layout = new org.jdesktop.layout.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel8Layout.createSequentialGroup()
                .add(jLabel8)
                .addContainerGap(252, Short.MAX_VALUE))
            .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jPanel8Layout.createSequentialGroup()
                    .add(86, 86, 86)
                    .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel30)
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel31)
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel32))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                        .add(morphiteSubtotalTextBox)
                        .add(morphiteQuantityTextBox)
                        .add(morphitePricePerTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(104, Short.MAX_VALUE)))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel8Layout.createSequentialGroup()
                .add(jLabel8)
                .addContainerGap(77, Short.MAX_VALUE))
            .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jPanel8Layout.createSequentialGroup()
                    .add(14, 14, 14)
                    .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jLabel30)
                        .add(morphitePricePerTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jLabel31)
                        .add(morphiteQuantityTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jLabel32)
                        .add(morphiteSubtotalTextBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(55, Short.MAX_VALUE)))
        );

        mainPanel.add(jPanel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(356, 556, -1, -1));

        statusPanel.setName("statusPanel"); // NOI18N

        jLabel33.setText(resourceMap.getString("jLabel33.text")); // NOI18N
        jLabel33.setName("jLabel33"); // NOI18N

        totalValueLabel.setText(resourceMap.getString("totalValueLabel.text")); // NOI18N
        totalValueLabel.setName("totalValueLabel"); // NOI18N

        iskIconLabel.setIcon(resourceMap.getIcon("iskIconLabel.icon")); // NOI18N
        iskIconLabel.setText(resourceMap.getString("iskIconLabel.text")); // NOI18N
        iskIconLabel.setName("iskIconLabel"); // NOI18N

        org.jdesktop.layout.GroupLayout statusPanelLayout = new org.jdesktop.layout.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel33)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(iskIconLabel)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(totalValueLabel)
                .addContainerGap(591, Short.MAX_VALUE))
        );
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, statusPanelLayout.createSequentialGroup()
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(statusPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel33)
                    .add(iskIconLabel))
                .addContainerGap())
            .add(statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(totalValueLabel)
                .addContainerGap(13, Short.MAX_VALUE))
        );

        jMenuBar1.setName("jMenuBar1"); // NOI18N

        lockPricesMenu.setIcon(resourceMap.getIcon("lockPricesMenu.icon")); // NOI18N
        lockPricesMenu.setText(resourceMap.getString("lockPricesMenu.text")); // NOI18N
        lockPricesMenu.setName("lockPricesMenu"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(jeveme.JEVEMeApp.class).getContext().getActionMap(JEVEMeMineralWorksheetBox.class, this);
        lockPricesMenuItem.setAction(actionMap.get("didPressLockPrices")); // NOI18N
        lockPricesMenuItem.setText(resourceMap.getString("lockPricesMenuItem.text")); // NOI18N
        lockPricesMenuItem.setName("lockPricesMenuItem"); // NOI18N
        lockPricesMenu.add(lockPricesMenuItem);

        jMenuBar1.add(lockPricesMenu);

        fetchOnlinePricesMenu.setIcon(resourceMap.getIcon("fetchOnlinePricesMenu.icon")); // NOI18N
        fetchOnlinePricesMenu.setText(resourceMap.getString("fetchOnlinePricesMenu.text")); // NOI18N
        fetchOnlinePricesMenu.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        fetchOnlinePricesMenu.setName("fetchOnlinePricesMenu"); // NOI18N

        addPriceSourceMenuItem.setText(resourceMap.getString("addPriceSourceMenuItem.text")); // NOI18N
        addPriceSourceMenuItem.setEnabled(false);
        addPriceSourceMenuItem.setName("addPriceSourceMenuItem"); // NOI18N
        fetchOnlinePricesMenu.add(addPriceSourceMenuItem);

        jSeparator1.setName("jSeparator1"); // NOI18N
        fetchOnlinePricesMenu.add(jSeparator1);

        battleClinicPricesMenuItem.setText(resourceMap.getString("battleClinicPricesMenuItem.text")); // NOI18N
        battleClinicPricesMenuItem.setEnabled(false);
        battleClinicPricesMenuItem.setName("battleClinicPricesMenuItem"); // NOI18N
        fetchOnlinePricesMenu.add(battleClinicPricesMenuItem);

        complexionPricesMenuItem.setText(resourceMap.getString("complexionPricesMenuItem.text")); // NOI18N
        complexionPricesMenuItem.setEnabled(false);
        complexionPricesMenuItem.setName("complexionPricesMenuItem"); // NOI18N
        fetchOnlinePricesMenu.add(complexionPricesMenuItem);

        eveCentralPricesMenuItem.setAction(actionMap.get("didPressUpdateMineralEveClinic")); // NOI18N
        eveCentralPricesMenuItem.setText(resourceMap.getString("eveCentralPricesMenuItem.text")); // NOI18N
        eveCentralPricesMenuItem.setName("eveCentralPricesMenuItem"); // NOI18N
        fetchOnlinePricesMenu.add(eveCentralPricesMenuItem);

        matariPricesMenuItem.setText(resourceMap.getString("matariPricesMenuItem.text")); // NOI18N
        matariPricesMenuItem.setEnabled(false);
        matariPricesMenuItem.setName("matariPricesMenuItem"); // NOI18N
        fetchOnlinePricesMenu.add(matariPricesMenuItem);

        jMenuBar1.add(fetchOnlinePricesMenu);

        resetQuantitiesMenu.setIcon(resourceMap.getIcon("resetQuantitiesMenu.icon")); // NOI18N
        resetQuantitiesMenu.setText(resourceMap.getString("resetQuantitiesMenu.text")); // NOI18N
        resetQuantitiesMenu.setName("resetQuantitiesMenu"); // NOI18N

        resetQuantitiesMenuItem.setAction(actionMap.get("didPressResetQuantities")); // NOI18N
        resetQuantitiesMenuItem.setText(resourceMap.getString("resetQuantitiesMenuItem.text")); // NOI18N
        resetQuantitiesMenuItem.setName("resetQuantitiesMenuItem"); // NOI18N
        resetQuantitiesMenu.add(resetQuantitiesMenuItem);

        jMenuBar1.add(resetQuantitiesMenu);

        jMenu4.setIcon(resourceMap.getIcon("jMenu4.icon")); // NOI18N
        jMenu4.setText(resourceMap.getString("jMenu4.text")); // NOI18N
        jMenu4.setName("jMenu4"); // NOI18N

        copyFormattedMenuItem.setAction(actionMap.get("didPressCopyFormatted")); // NOI18N
        copyFormattedMenuItem.setText(resourceMap.getString("copyFormattedMenuItem.text")); // NOI18N
        copyFormattedMenuItem.setName("copyFormattedMenuItem"); // NOI18N
        jMenu4.add(copyFormattedMenuItem);

        copyUnformattedMenuItem.setAction(actionMap.get("didPressCopyUnformatted")); // NOI18N
        copyUnformattedMenuItem.setText(resourceMap.getString("copyUnformattedMenuItem.text")); // NOI18N
        copyUnformattedMenuItem.setName("copyUnformattedMenuItem"); // NOI18N
        jMenu4.add(copyUnformattedMenuItem);

        jMenuBar1.add(jMenu4);

        setJMenuBar(jMenuBar1);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, statusPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .add(mainPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 730, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .add(mainPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 741, Short.MAX_VALUE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(statusPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    
    
    private void tritaniumPricePerTextBoxFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tritaniumPricePerTextBoxFocusLost
        BigDecimal price = new BigDecimal(tritaniumPricePerTextBox.getText());
        BigDecimal qty = new BigDecimal(tritaniumQuantityTextBox.getText());
        BigDecimal subtotal = price.multiply(qty); 
        tritaniumSubtotalTextBox.setText(subtotal.toString());
        updateTotals();
    }//GEN-LAST:event_tritaniumPricePerTextBoxFocusLost

    private void tritaniumQuantityTextBoxFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tritaniumQuantityTextBoxFocusLost
        BigDecimal price = new BigDecimal(tritaniumPricePerTextBox.getText());
        BigDecimal qty = new BigDecimal(tritaniumQuantityTextBox.getText());
        BigDecimal subtotal = price.multiply(qty); 
        tritaniumSubtotalTextBox.setText(subtotal.toString());
        updateTotals();
    }//GEN-LAST:event_tritaniumQuantityTextBoxFocusLost

    private void pyeritePricePerTextBoxFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_pyeritePricePerTextBoxFocusLost
        BigDecimal price = new BigDecimal(pyeritePricePerTextBox.getText());
        BigDecimal qty = new BigDecimal(pyeriteQuantityTextBox.getText());
        BigDecimal subtotal = price.multiply(qty); 
        pyeriteSubtotalTextBox.setText(subtotal.toString());;
        updateTotals();
    }//GEN-LAST:event_pyeritePricePerTextBoxFocusLost

    private void pyeriteQuantityTextBoxFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_pyeriteQuantityTextBoxFocusLost
        BigDecimal price = new BigDecimal(pyeritePricePerTextBox.getText());
        BigDecimal qty = new BigDecimal(pyeriteQuantityTextBox.getText());
        BigDecimal subtotal = price.multiply(qty); 
        pyeriteSubtotalTextBox.setText(subtotal.toString());;
        updateTotals();
    }//GEN-LAST:event_pyeriteQuantityTextBoxFocusLost

    private void mexallonPricePerTextBoxFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_mexallonPricePerTextBoxFocusLost
        BigDecimal price = new BigDecimal(mexallonPricePerTextBox.getText());
        BigDecimal qty = new BigDecimal(mexallonQuantityTextBox.getText());
        BigDecimal subtotal = price.multiply(qty); 
        mexallonSubtotalTextBox.setText(subtotal.toString());;
        updateTotals();
    }//GEN-LAST:event_mexallonPricePerTextBoxFocusLost

    private void mexallonQuantityTextBoxFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_mexallonQuantityTextBoxFocusLost
        BigDecimal price = new BigDecimal(mexallonPricePerTextBox.getText());
        BigDecimal qty = new BigDecimal(mexallonQuantityTextBox.getText());
        BigDecimal subtotal = price.multiply(qty); 
        mexallonSubtotalTextBox.setText(subtotal.toString());;
        updateTotals();
    }//GEN-LAST:event_mexallonQuantityTextBoxFocusLost

    private void isogenPricePerTextBoxFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_isogenPricePerTextBoxFocusLost
        BigDecimal price = new BigDecimal(isogenPricePerTextBox.getText());
        BigDecimal qty = new BigDecimal(isogenQuantityTextBox.getText());
        BigDecimal subtotal = price.multiply(qty); 
        isogenSubtotalTextBox.setText(subtotal.toString());;
        updateTotals();
    }//GEN-LAST:event_isogenPricePerTextBoxFocusLost

    private void isogenQuantityTextBoxFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_isogenQuantityTextBoxFocusLost
        BigDecimal price = new BigDecimal(isogenPricePerTextBox.getText());
        BigDecimal qty = new BigDecimal(isogenQuantityTextBox.getText());
        BigDecimal subtotal = price.multiply(qty); 
        isogenSubtotalTextBox.setText(subtotal.toString());;
        updateTotals();
    }//GEN-LAST:event_isogenQuantityTextBoxFocusLost

    private void nocxiumPricePerTextBoxFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_nocxiumPricePerTextBoxFocusLost
        BigDecimal price = new BigDecimal(nocxiumPricePerTextBox.getText());
        BigDecimal qty = new BigDecimal(nocxiumQuantityTextBox.getText());
        BigDecimal subtotal = price.multiply(qty); 
        nocxiumSubtotalTextBox.setText(subtotal.toString());;
        updateTotals();
    }//GEN-LAST:event_nocxiumPricePerTextBoxFocusLost

    private void nocxiumQuantityTextBoxFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_nocxiumQuantityTextBoxFocusLost
        BigDecimal price = new BigDecimal(nocxiumPricePerTextBox.getText());
        BigDecimal qty = new BigDecimal(nocxiumQuantityTextBox.getText());
        BigDecimal subtotal = price.multiply(qty); 
        nocxiumSubtotalTextBox.setText(subtotal.toString());;
        updateTotals();
    }//GEN-LAST:event_nocxiumQuantityTextBoxFocusLost

    private void zydrinePricePerTextBoxFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_zydrinePricePerTextBoxFocusLost
        BigDecimal price = new BigDecimal(zydrinePricePerTextBox.getText());
        BigDecimal qty = new BigDecimal(zydrineQuantityTextBox.getText());
        BigDecimal subtotal = price.multiply(qty); 
        zydrineSubtotalTextBox.setText(subtotal.toString());;
        updateTotals();
    }//GEN-LAST:event_zydrinePricePerTextBoxFocusLost

    private void zydrineQuantityTextBoxFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_zydrineQuantityTextBoxFocusLost
        BigDecimal price = new BigDecimal(zydrinePricePerTextBox.getText());
        BigDecimal qty = new BigDecimal(zydrineQuantityTextBox.getText());
        BigDecimal subtotal = price.multiply(qty); 
        zydrineSubtotalTextBox.setText(subtotal.toString());;
        updateTotals();
    }//GEN-LAST:event_zydrineQuantityTextBoxFocusLost

    private void megacytePricePerTextBoxFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_megacytePricePerTextBoxFocusLost
        BigDecimal price = new BigDecimal(megacytePricePerTextBox.getText());
        BigDecimal qty = new BigDecimal(megacyteQuantityTextBox.getText());
        BigDecimal subtotal = price.multiply(qty); 
        megacyteSubtotalTextBox.setText(subtotal.toString());;
        updateTotals();
    }//GEN-LAST:event_megacytePricePerTextBoxFocusLost

    private void megacyteQuantityTextBoxFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_megacyteQuantityTextBoxFocusLost
        BigDecimal price = new BigDecimal(megacytePricePerTextBox.getText());
        BigDecimal qty = new BigDecimal(megacyteQuantityTextBox.getText());
        BigDecimal subtotal = price.multiply(qty); 
        megacyteSubtotalTextBox.setText(subtotal.toString());;
        updateTotals();
    }//GEN-LAST:event_megacyteQuantityTextBoxFocusLost

    private void morphitePricePerTextBoxFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_morphitePricePerTextBoxFocusLost
        BigDecimal price = new BigDecimal(morphitePricePerTextBox.getText());
        BigDecimal qty = new BigDecimal(morphiteQuantityTextBox.getText());
        BigDecimal subtotal = price.multiply(qty); 
        morphiteSubtotalTextBox.setText(subtotal.toString());;
        updateTotals();
    }//GEN-LAST:event_morphitePricePerTextBoxFocusLost

    private void morphiteQuantityTextBoxFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_morphiteQuantityTextBoxFocusLost
        BigDecimal price = new BigDecimal(morphitePricePerTextBox.getText());
        BigDecimal qty = new BigDecimal(morphiteQuantityTextBox.getText());
        BigDecimal subtotal = price.multiply(qty);  
        morphiteSubtotalTextBox.setText(subtotal.toString());;
        updateTotals();
    }//GEN-LAST:event_morphiteQuantityTextBoxFocusLost

    private void updateTotals() {
        //Update Totals
        BigDecimal total = new BigDecimal(tritaniumSubtotalTextBox.getText());
        total = total.add(new BigDecimal(pyeriteSubtotalTextBox.getText()));
        total = total.add(new BigDecimal(mexallonSubtotalTextBox.getText()));
        total = total.add(new BigDecimal(isogenSubtotalTextBox.getText()));
        total = total.add(new BigDecimal(nocxiumSubtotalTextBox.getText()));
        total = total.add(new BigDecimal(zydrineSubtotalTextBox.getText()));
        total = total.add(new BigDecimal(megacyteSubtotalTextBox.getText()));
        total = total.add(new BigDecimal(morphiteSubtotalTextBox.getText()));
        
        java.text.DecimalFormatSymbols symbols = new java.text.DecimalFormatSymbols();
        symbols.setGroupingSeparator(',');
        java.text.DecimalFormat formatter = new java.text.DecimalFormat("###,###.00",symbols);
        String formatted=formatter.format(total);
        totalValueLabel.setText(formatted + " ISK");
        
        //Update the copy to clipboard menu with the prices.
        copyFormattedMenuItem.setText("Formatted (" + total.toString() +" ISK)");
        copyUnformattedMenuItem.setText("Unformatted (" + total.toString() + ")");

    }
    
    /**
     * This function will parse and update text boxes based on a standard
     * XML format for mineral prices
     * @param xml A string with standard mineral XML data.
     */
    private void parseMarketReportXMLStandardFormat(String xml) {
        try {
            DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = domFactory.newDocumentBuilder();
            org.xml.sax.InputSource is = new org.xml.sax.InputSource();
            is.setCharacterStream(new java.io.StringReader(xml));
            Document doc = builder.parse(is);
            XPath xpath = XPathFactory.newInstance().newXPath();
            
            XPathExpression tritanium_expression = xpath.compile("/minerals/mineral[name='Tritanium']/price/text()");
            XPathExpression pyerite_expression = xpath.compile("/minerals/mineral[name='Pyerite']/price/text()");
            XPathExpression mexallon_expression = xpath.compile("/minerals/mineral[name='Mexallon']/price/text()");
            XPathExpression isogen_expression = xpath.compile("/minerals/mineral[name='Isogen']/price/text()");
            XPathExpression nocxium_expression = xpath.compile("/minerals/mineral[name='Nocxium']/price/text()");
            XPathExpression zydrine_expression = xpath.compile("/minerals/mineral[name='Zydrine']/price/text()");
            XPathExpression megacyte_expression = xpath.compile("/minerals/mineral[name='Megacyte']/price/text()");
            XPathExpression morphite_expression = xpath.compile("/minerals/mineral[name='Morphite']/price/text()");
            
            Object tritanium_result = tritanium_expression.evaluate(doc, XPathConstants.NODESET);
            Object pyerite_result = pyerite_expression.evaluate(doc, XPathConstants.NODESET);
            Object mexallon_result = mexallon_expression.evaluate(doc, XPathConstants.NODESET);
            Object isogen_result = isogen_expression.evaluate(doc, XPathConstants.NODESET);
            Object nocxium_result = nocxium_expression.evaluate(doc, XPathConstants.NODESET);
            Object zydrine_result = zydrine_expression.evaluate(doc, XPathConstants.NODESET);
            Object megacyte_result = megacyte_expression.evaluate(doc, XPathConstants.NODESET);
            Object morphite_result = morphite_expression.evaluate(doc, XPathConstants.NODESET);
            
            NodeList tritanium_nodes = (NodeList) tritanium_result;
            NodeList pyerite_nodes = (NodeList) pyerite_result;
            NodeList mexallon_nodes = (NodeList) mexallon_result;
            NodeList isogen_nodes = (NodeList) isogen_result;
            NodeList nocxium_nodes = (NodeList) nocxium_result;
            NodeList zydrine_nodes = (NodeList) zydrine_result;
            NodeList megacyte_nodes = (NodeList) megacyte_result;
            NodeList morphite_nodes = (NodeList) morphite_result;
            
            BigDecimal tritanium_price = new BigDecimal(tritanium_nodes.item(0).getNodeValue());
            tritanium_price = tritanium_price.setScale(2, BigDecimal.ROUND_HALF_UP);
            
            BigDecimal pyerite_price = new BigDecimal(pyerite_nodes.item(0).getNodeValue());
            pyerite_price = pyerite_price.setScale(2, BigDecimal.ROUND_HALF_UP);
            
            BigDecimal mexallon_price = new BigDecimal(mexallon_nodes.item(0).getNodeValue());
            mexallon_price = mexallon_price.setScale(2, BigDecimal.ROUND_HALF_UP);
            
            BigDecimal isogen_price = new BigDecimal(isogen_nodes.item(0).getNodeValue());
            isogen_price = isogen_price.setScale(2, BigDecimal.ROUND_HALF_UP);
            
            BigDecimal nocxium_price = new BigDecimal(nocxium_nodes.item(0).getNodeValue());
            nocxium_price = nocxium_price.setScale(2, BigDecimal.ROUND_HALF_UP);
            
            BigDecimal zydrine_price = new BigDecimal(zydrine_nodes.item(0).getNodeValue());
            zydrine_price = zydrine_price.setScale(2, BigDecimal.ROUND_HALF_UP);
            
            BigDecimal megacyte_price = new BigDecimal(megacyte_nodes.item(0).getNodeValue());
            megacyte_price = megacyte_price.setScale(2, BigDecimal.ROUND_HALF_UP);
            
            BigDecimal morphite_price = new BigDecimal(morphite_nodes.item(0).getNodeValue());
            morphite_price = morphite_price.setScale(2, BigDecimal.ROUND_HALF_UP);
            
            //Set the text fields.
            tritaniumPricePerTextBox.setText(tritanium_price.toString());
            pyeritePricePerTextBox.setText(pyerite_price.toString());
            mexallonPricePerTextBox.setText(mexallon_price.toString());
            isogenPricePerTextBox.setText(isogen_price.toString());
            nocxiumPricePerTextBox.setText(nocxium_price.toString());
            zydrinePricePerTextBox.setText(zydrine_price.toString());
            megacytePricePerTextBox.setText(megacyte_price.toString());
            morphitePricePerTextBox.setText(morphite_price.toString());
            
        }//End of Try
        catch (Exception e){};
    }
    
    @Action
    public void didPressCopyFormatted() {
        
        BigDecimal total = new BigDecimal(tritaniumSubtotalTextBox.getText());
        total = total.add(new BigDecimal(pyeriteSubtotalTextBox.getText()));
        total = total.add(new BigDecimal(mexallonSubtotalTextBox.getText()));
        total = total.add(new BigDecimal(isogenSubtotalTextBox.getText()));
        total = total.add(new BigDecimal(nocxiumSubtotalTextBox.getText()));
        total = total.add(new BigDecimal(zydrineSubtotalTextBox.getText()));
        total = total.add(new BigDecimal(megacyteSubtotalTextBox.getText()));
        total = total.add(new BigDecimal(morphiteSubtotalTextBox.getText()));
        
        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
        
        StringSelection s = new StringSelection(total.toString() + " ISK");
        clipboard.setContents(s, null);
    }
    
    @Action
    public void didPressCopyUnformatted() {
        
        BigDecimal total = new BigDecimal(tritaniumSubtotalTextBox.getText());
        total = total.add(new BigDecimal(pyeriteSubtotalTextBox.getText()));
        total = total.add(new BigDecimal(mexallonSubtotalTextBox.getText()));
        total = total.add(new BigDecimal(isogenSubtotalTextBox.getText()));
        total = total.add(new BigDecimal(nocxiumSubtotalTextBox.getText()));
        total = total.add(new BigDecimal(zydrineSubtotalTextBox.getText()));
        total = total.add(new BigDecimal(megacyteSubtotalTextBox.getText()));
        total = total.add(new BigDecimal(morphiteSubtotalTextBox.getText()));
        
        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
        
        StringSelection s = new StringSelection(total.toString());
        clipboard.setContents(s, null);
    }
    
    @Action
    public void didPressResetQuantities() {
        tritaniumQuantityTextBox.setText("0");
        tritaniumQuantityTextBoxFocusLost(null);
        pyeriteQuantityTextBox.setText("0");
        pyeriteQuantityTextBoxFocusLost(null);
        mexallonQuantityTextBox.setText("0");
        mexallonQuantityTextBoxFocusLost(null);
        isogenQuantityTextBox.setText("0");
        isogenQuantityTextBoxFocusLost(null);
        nocxiumQuantityTextBox.setText("0");
        nocxiumQuantityTextBoxFocusLost(null);
        zydrineQuantityTextBox.setText("0");
        zydrineQuantityTextBoxFocusLost(null);
        megacyteQuantityTextBox.setText("0");
        megacyteQuantityTextBoxFocusLost(null);
        morphiteQuantityTextBox.setText("0");
        morphiteQuantityTextBoxFocusLost(null);
        
    }
    
    @Action
    public void didPressUpdateMineralEveClinic() {
        EveClinicPriceFetcher ecpf = new EveClinicPriceFetcher();
        new Thread(ecpf).start();
        
    }
    
    @Action
    public void didPressLockPrices() {
        boolean lock = lockPricesMenuItem.getState();
        if(lock) {
            tritaniumPricePerTextBox.setEditable(false);
            pyeritePricePerTextBox.setEditable(false);
            mexallonPricePerTextBox.setEditable(false);
            isogenPricePerTextBox.setEditable(false);
            nocxiumPricePerTextBox.setEditable(false);
            zydrinePricePerTextBox.setEditable(false);
            megacytePricePerTextBox.setEditable(false);
            morphitePricePerTextBox.setEditable(false);
        }
        else {
            tritaniumPricePerTextBox.setEditable(true);
            pyeritePricePerTextBox.setEditable(true);
            mexallonPricePerTextBox.setEditable(true);
            isogenPricePerTextBox.setEditable(true);
            nocxiumPricePerTextBox.setEditable(true);
            zydrinePricePerTextBox.setEditable(true);
            megacytePricePerTextBox.setEditable(true);
            morphitePricePerTextBox.setEditable(true);
        }
    }
    
    /**
     * 
     * @param URL
     * @return 
     */
    private String getXMLFromURL(String url_to_fetch) {
        String xml_response = "";
        try {
            
            // Send data
            URL url = new URL(url_to_fetch);
            URLConnection conn = url.openConnection();
            
            // Get the response
            BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String line;
            while ((line = rd.readLine()) != null) {
                xml_response += line;
            }
            rd.close();
            
        } 
        catch (Exception e) {xml_response = "error";}
        return xml_response;
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                JEVEMeMineralWorksheetBox dialog = new JEVEMeMineralWorksheetBox(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {

                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem addPriceSourceMenuItem;
    private javax.swing.JMenuItem battleClinicPricesMenuItem;
    private javax.swing.JMenuItem complexionPricesMenuItem;
    private javax.swing.JMenuItem copyFormattedMenuItem;
    private javax.swing.JMenuItem copyUnformattedMenuItem;
    private javax.swing.JMenuItem eveCentralPricesMenuItem;
    private javax.swing.JMenu fetchOnlinePricesMenu;
    private javax.swing.JLabel iskIconLabel;
    private javax.swing.JTextField isogenPricePerTextBox;
    private javax.swing.JTextField isogenQuantityTextBox;
    private javax.swing.JTextField isogenSubtotalTextBox;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JMenu lockPricesMenu;
    private javax.swing.JCheckBoxMenuItem lockPricesMenuItem;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuItem matariPricesMenuItem;
    private javax.swing.JTextField megacytePricePerTextBox;
    private javax.swing.JTextField megacyteQuantityTextBox;
    private javax.swing.JTextField megacyteSubtotalTextBox;
    private javax.swing.JTextField mexallonPricePerTextBox;
    private javax.swing.JTextField mexallonQuantityTextBox;
    private javax.swing.JTextField mexallonSubtotalTextBox;
    private javax.swing.JTextField morphitePricePerTextBox;
    private javax.swing.JTextField morphiteQuantityTextBox;
    private javax.swing.JTextField morphiteSubtotalTextBox;
    private javax.swing.JTextField nocxiumPricePerTextBox;
    private javax.swing.JTextField nocxiumQuantityTextBox;
    private javax.swing.JTextField nocxiumSubtotalTextBox;
    private javax.swing.JTextField pyeritePricePerTextBox;
    private javax.swing.JTextField pyeriteQuantityTextBox;
    private javax.swing.JTextField pyeriteSubtotalTextBox;
    private javax.swing.JMenu resetQuantitiesMenu;
    private javax.swing.JMenuItem resetQuantitiesMenuItem;
    private javax.swing.JPanel statusPanel;
    private javax.swing.JLabel totalValueLabel;
    private javax.swing.JTextField tritaniumPricePerTextBox;
    private javax.swing.JTextField tritaniumQuantityTextBox;
    private javax.swing.JTextField tritaniumSubtotalTextBox;
    private javax.swing.JTextField zydrinePricePerTextBox;
    private javax.swing.JTextField zydrineQuantityTextBox;
    private javax.swing.JTextField zydrineSubtotalTextBox;
    // End of variables declaration//GEN-END:variables

    private static final String m_EVEClinicURL = "http://api.eve-central.com/api/evemon";
    
    class EveClinicPriceFetcher implements Runnable{ //For threading purposes
        public void run() {
            String xml = getXMLFromURL(m_EVEClinicURL);
            if(xml.equals("error")) {
                return;
            }
            parseMarketReportXMLStandardFormat(xml);
            updateTotals();
        }
    }
    
    class GenericApiFetcher implements Runnable { //For threading purposes
        
        private String api_url;
        
        public GenericApiFetcher(String ApiUrl) {
            api_url = ApiUrl;
        }
        public void run() {
            String xml = getXMLFromURL(api_url);
            if(xml.equals("error")) {
                return;
            }
            parseMarketReportXMLStandardFormat(xml);
            updateTotals();
        }
    }
}
